package org.n.shop.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.n.shop.domain.Do.SelectAllOrderDetailDo;
import org.n.shop.domain.Do.SelectLastOrderDetailDo;
import org.n.shop.domain.Do.SelectOrderDetailByIdDo;
import org.n.shop.domain.entity.OrderDetail;

import java.util.List;

@Mapper
public interface OrderDetailMapper {
    /**
     * 查询最新的订单细节
     *
     * @param userId
     * @return
     */
    List<SelectLastOrderDetailDo> selectLastOrderDetail(@Param("userId") int userId);
    List<SelectAllOrderDetailDo> selectAllOrderDetail(@Param("userId") int userId,
                                                      @Param("timeType") int timeType,
                                                      @Param("page") int page,
                                                      @Param("pageSize") int pageSize,
                                                      @Param("logisticsState") int logisticsState,
                                                      @Param("key") String key);
    int totalAllOrderDetail(@Param("userId") int userId, @Param("timeType") int timeType, @Param("logisticsState") int logisticsState, @Param("key") String key);
    SelectOrderDetailByIdDo selectOrderDetailById(@Param("id") int id);
    int del(@Param("id") int id);

    int insertBatch(@Param("orderDetails") List<OrderDetail> orderDetails);

    int updateLogisticsType(@Param("orderId") int orderId,
                            @Param("logisticsType") int logisticsType);

    int totalAllOrderDetailByOrderId(int orderId);
}
